<%@ Page Title="Member_Info Item" Language="C#" AutoEventWireup="true" CodeBehind="Member_InfoItem.aspx.cs" Inherits="Youz.CreditRepay.Manage.Member_InfoItem" %>

<script>
    

    var requireJS = [
        //"assets/js/jquery.form.js"
    ];
    loadJS(requireJS);
</script>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h2><i class="fa fa-edit"></i><%: R(LanguageModule.Member_Info, "Member_Info", "Member_Info") %></h2>
            </div>
            <div class="panel-body">
                <form id="frm" class="form-horizontal" method="post" enctype="multipart/form-data" action="Member/Handlers/Member_InfoHandler.ashx?type=save">
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Member_Info, "MemberAccount", "会员帐号") %></label>
                        <div class="controls">
                            <input type="text" id="MemberAccount" name="MemberAccount" maxlength="100" class="form-control required" readonly="readonly" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Member_Info, "LastName", "姓名") %></label>
                        <div class="controls">
                            <input type="text" id="LastName" name="LastName" maxlength="20" class="form-control required" />
                        </div>
                    </div>
                    <%--<div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Member_Info, "FirstName", "名") %></label>
                        <div class="controls">
                            <input type="text" id="FirstName" name="FirstName" maxlength="100" class="form-control" />
                        </div>
                    </div>--%>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Member_Info, "Sex", "性别") %></label>
                        <div class="controls">
                            <select name="Sex" id="Sex" class="form-control">
                                <option value="1"><%=R(LanguageModule.M_Common, "male", "男") %></option>
                                <option value="2"><%=R(LanguageModule.M_Common, "Female", "女") %></option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Member_Info, "CredentialsType", "证件类型") %></label>
                        <div class="controls">
                            <select id="CredentialsType" name="CredentialsType" class="form-control">
                                <option value="护照">护照</option>
                                <option value="驾照">驾照</option>
                                <option value="身份证">身份证</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Member_Info, "CredentialsNum", "证件号") %></label>
                        <div class="controls">
                            <input type="text" id="CredentialsNum" name="CredentialsNum" maxlength="40" class="form-control " />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Member_Info, "Email", "邮箱") %></label>
                        <div class="controls">
                            <input type="text" id="Email" name="Email" maxlength="40" class="form-control " />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Member_Info, "MobileNo", "手机号") %></label>
                        <div class="controls">
                            <input type="text" id="MobileNo" name="MobileNo" maxlength="20" class="form-control required" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Member_Info, "Status", "状态") %></label>
                        <div class="controls">
                            <select name="Status" id="Status" class="form-control">
                                <option value=""><%: R(LanguageModule.M_Common, "All", "全部") %></option>
                               <%-- <option value="0"><%=R(LanguageModule.M_Common, "NotActivated", "未激活") %></option>--%>
                                <option value="1"><%=R(LanguageModule.M_Common, "normal", "正常") %></option>
                                <option value="2"><%=R(LanguageModule.M_Common, "nolog", "不能登录") %></option>
                                <option value="3"><%=R(LanguageModule.M_Common, "Inoperablefunds", "不能操作资金") %></option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Member_Info, "Area", "地区") %></label>
                        <div class="controls">
                            <select id="Area" name="Area" class="form-control">
                                <% 
                                    System.Data.DataTable dt = new Youz.CreditRepay.BLL.Member_AreaBLL().Gets("").Tables[0];
                                    foreach (System.Data.DataRow item in dt.Rows)
                                    {
                                %>
                                <option value="<%=item["AreaID"] %>"><%=item["AreaName"] %></option>
                                <%
                                    }
                                %>
                            </select>
                        </div>
                    </div>
                    <div class="alert alert-danger" style="display: none;">
                        <%--                        <div class="col-sm-12">
                            <small style="color: #f86c6b; display: none;" class="help-block" id="errmsg"></small>
                        </div>--%>
                        <button type="button" class="close" data-dismiss="alert">×</button><strong>Oh snap!</strong><span class="content"></span>
                    </div>
                    <div class="form-actions">
                        <button class="btn btn-success" type="submit" id="btnSubmit"><%: R(LanguageModule.M_Common, "btnSubmit", "保存修改") %></button>
                        <button class="btn btn-default" type="button" id="btnCancel"><%: R(LanguageModule.M_Common, "btnCancel", "取消") %></button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

    var flag = false;
    var reg = /^\d*$/;
    var chinaReg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/; // 中国手机号规则

    function validate() {
        return $("#frm").valid();
    };

    function get() {
        $.post("Member/Handlers/Member_InfoHandler.ashx?type=get", { MemberAccount: "<%= WebHelper.Get("MemberAccount") %>" }, function (data) {
            $('#frm').fill(data);
            $("#Status").attr("value", data.Status);
            $("#Sex").attr("value", data.Sex);
            $("#Area").val(data.Area);
            $("#CredentialsType").val(data.CredentialsType);
        }, 'json');
    }

    $(function () {
        $("#frm").validate({
            errorElement: "span"
        });

        get();
        $("#btnSubmit").click(function () {
            var MobileNo = $("#MobileNo").val().trim();
            if (MobileNo == '') {
                $(".alert > .content").html("手机号不能为空");
                $(".alert").show();
                return false;
            }
            else if ($(".selected-flag").attr("data-dial-code") == "86" && !chinaReg.test(MobileNo)) {
                $(".alert > .content").html("手机号格式不正确");
                $(".alert").show();
                return false;
            }
            else if (MobileNo != "" && !reg.test(MobileNo)) {
                $(".alert > .content").html("手机号格式不正确");
                $(".alert").show();
                return false;
            }
            $("#frm").ajaxForm({
                dataType: 'json',
                beforeSubmit: function (arr, $form, options) {
                    if (flag) {
                        return false;
                    }
                    else {
                        flag = true;
                        return true;
                    }
                },
                success: function (data) {
                    if (data.isSuccess) {
                        loadPage("Member/Member_InfoList.aspx");
                    }
                    else {
                        $(".alert > .content").html(data.message);
                        $(".alert").show();
                    }
                    flag = false;
                }
            });
        });


        $("#btnCancel").click(function () {
            loadPage("Member/Member_InfoList.aspx");
        });
    });


    function validate() {
        //$("#errmsg").text("").hide();


    }


</script>
